<form class="form-horizontal" [formGroup]="form" >
  <div class="form-group">
    <label class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-9">
      <input type="email" class="form-control" placeholder="姓名"
             formControlName="name"  minlength="2"
             greatByteLength="30"
      >
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-9 col-sm-offset-2 has-error" *ngIf="form.get('name').dirty && form.get('name').errors">
      至少2个字符，至多15个字符！
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">年龄</label>
    <div class="col-sm-9">
      <input type="number" class="form-control" placeholder="年龄"
             formControlName="age"
             greatNumber="3"
      >
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-9">
      <button type="submit" class="btn btn-default" [disabled]="!form.valid">保 存</button>
    </div>
  </div>
</form>
